export interface CreditPageRespVO {
  customerName: string;
  customerCode: string;
  id: string;
  customerId: string;
  creditCode: string;
  creditAmount: number;
  creditDuration: number;
  status: number;
  creditTime: number;
  dueTime: number;
  createTime: number;
  confirmTime?: number;
  operatorDesc?: string;
  remark?: string;
  creditType?: string;
}

export enum CreditStatus {
  PENDING = 0,
  ACTIVE = 1,
  FROZEN = 2,
  EXPIRED = 3,
  CANCELLED = 4,
}

export const getStatusDesc = (status: number): string => {
  switch (status) {
    case CreditStatus.PENDING: return '待审核';
    case CreditStatus.ACTIVE: return '已生效';
    case CreditStatus.FROZEN: return '已冻结';
    case CreditStatus.EXPIRED: return '已到期';
    case CreditStatus.CANCELLED: return '已取消';
    default: return '未知状态';
  }
};

export const statusColorMap: Record<CreditStatus, string> = {
  [CreditStatus.PENDING]: 'blue',
  [CreditStatus.ACTIVE]: 'green',
  [CreditStatus.FROZEN]: 'orange',
  [CreditStatus.EXPIRED]: 'red',
  [CreditStatus.CANCELLED]: 'gray',
};

export enum CreditType {
  TEMPORARY = '1',
  FIXED = '2',
  RECURRENT = '3',
}

export const getTypeDesc = (type: string): string => {
  switch (type) {
    case CreditType.TEMPORARY: return '临时授信';
    case CreditType.FIXED: return '固定授信';
    case CreditType.RECURRENT: return '循环授信';
    default: return '未知类型';
  }
};

export const typeColorMap: Record<CreditType, string> = {
  [CreditType.TEMPORARY]: 'blue',
  [CreditType.FIXED]: 'green',
  [CreditType.RECURRENT]: 'purple',
};